package com.mew.chess.core.game.yxx.game.message;

import com.mew.chess.core.game.yxx.game.core.YxxGame;
import com.zebra.common.ZebraBaseMessage;
import io.netty.buffer.ByteBuf;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.ArrayList;
import java.util.List;


/**
 * 发牌信息
 */
@Data
@ToString
@NoArgsConstructor
public class YxxDealCardMessage extends ZebraBaseMessage<YxxDealCardMessage> {

    //private int rollerId;
    //private int controlRoom; //0 not 1  5
    public List<int[]> winArea = new ArrayList<>();
    public YxxGame yxxGame = new YxxGame();

    @Override
    public void write(ByteBuf b) {

        writeMsg(b);
    }

    public void writeMsg(ByteBuf b) {
        writeInt(b,winArea.size());
        for (int[] wa : winArea) {
            writeIntArray(b,wa);
        }

        yxxGame.write(b);
    }

    @Override
    public YxxDealCardMessage read(ByteBuf byteBuf) {
        return null;
    }

    public void clearInfo(){
        yxxGame.initDice(-1);
    };
}
